<template>
  <!-- 成交管理 -->
  <el-container>
    <el-header>
      <div class="left-panel">
        <!-- <el-button
          type="primary"
          icon="el-icon-plus"
          @click="add"
          v-auth-button="['add/vendorProducts']"
        ></el-button> -->
      </div>
      <div class="right-panel">
        <div class="right-panel-search">
          <el-input
            v-model="searchValue.name"
            placeholder="客户名称"
            clearable
          ></el-input>
          <el-date-picker
            v-model="searchValue.startTime"
            value-format="YYYY-MM-DD"
            type="date"
            placeholder="开始时间"
            :teleported="false"
            style="width: 100%"
          ></el-date-picker>
          <el-date-picker
            v-model="searchValue.endTime"
            value-format="YYYY-MM-DD"
            type="date"
            placeholder="结束时间"
            :teleported="false"
            style="width: 100%"
          ></el-date-picker>
          <el-button
            type="primary"
            icon="el-icon-search"
            @click="upsearch"
          ></el-button>
        </div>
      </div>
    </el-header>
    <el-main class="nopadding">
      <scTable
        ref="table"
        :apiObj="apiObj"
        row-key="id"
        stripe
        @row-dblclick="handleRowDblclick"
      >
        <el-table-column label="ID" prop="id" width="50"></el-table-column>
        <el-table-column
          label="客户名称"
          prop="customerName"
          min-width="200"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <el-table-column
          label="合同成交量"
          prop="numbers"
          min-width="200"
          :show-overflow-tooltip="true"
        ></el-table-column>
        <!-- <el-table-column label="操作" fixed="right" align="center" width="200">
          <template #default="scope">
            <el-button-group>
              <el-button
                text
                type="primary"
                size="small"
                @click="table_show(scope.row, scope.$index)"
                >查看</el-button
              >
            </el-button-group>
          </template>
        </el-table-column> -->
      </scTable>
    </el-main>
  </el-container>
</template>

<script>

export default {
  name: 'dealRecord',
  data () {
    return {
      dialog: {
        save: false,
      },
      apiObj: this.$API.customer.getDealRecords,
      searchValue: {
        name: null,
        startTime: null,
        endTime: null
      }
    }
  },
  methods: {
    //添加
    add () {
      this.dialog.save = true
      this.$nextTick(() => {
        this.$refs.saveDialog.open()
      })
      // this.$router.push({
      //   path: '/customer/vendorProducts/addProduct'
      // })
    },

    //查看
    table_show (row) {
      this.dialog.save = true
      this.$nextTick(() => {
        this.$refs.saveDialog.open('show').setData(row)
      })
    },

    //搜索
    upsearch () {
      this.$refs.table.upData(this.searchValue)
    },
    //本地更新数据
    handleSaveSuccess () {
      this.$refs.table.refresh()
    },
    // 双击表格
    handleRowDblclick (row) {
      this.table_edit(row)
    }

  }
}
</script>

<style>
</style>